
from PySide2.QtWidgets import QTabWidget, QWidget, QLabel, QHBoxLayout, QVBoxLayout
from localvideo import LocalVideo
from accountview import AccountView
from tabyoukuvideo import TabYoukuVideo
from tabtxvideo import TabTXVideo
from tabcollect import TabCollect
from manager import Manager
from tool import dbutil

class Ui_Home(object):

    def setupUi(self, Home):
        self.accountView = AccountView()

        self.boxLayout = QHBoxLayout()
        self.setLayout(self.boxLayout)

        self.localVideo = LocalVideo()
        self.txVideo = TabTXVideo()
        self.txVideo.updateUploador_signal.connect(self.onUpdateUploader)
        self.youkuVideo = TabYoukuVideo()
        self.collect = TabCollect()

        self.tabWidget = QTabWidget()

        self.tabWidget.addTab(self.localVideo, '本地视频')
        self.tabWidget.addTab(self.txVideo, '腾讯视频')
        self.tabWidget.addTab(self.collect, '采集视频')

        # self.tabWidget.addTab(self.youkuVideo, '优酷视频')

        self.boxLayout.addWidget(self.accountView)
        self.boxLayout.addWidget(self.tabWidget)

        self.boxLayout.setStretchFactor(self.tabWidget, 1)

    def onUpdateUploader(self):
        Manager.consoleWidget.normalOutputWarp("【更新上传视频数量】")
        self.accountView.setupData()
